package com.icreate.storm.methods.indicators;

import com.icreate.entity.indicator.IndicatorID;
import com.icreate.entity.indicator.UE_MRfield;
import com.icreate.storm.methods.common.DateMethod;
import org.apache.storm.tuple.Values;

/**
 * Created by hadoop on 17-5-3.
 */
public class UE_MRIndicator extends BaseIndicator {
    public static final String typeName = "uemr";

    @Override
    public String getTypeName() {
        return typeName;
    }

    public static final String[] fields = {"type", "cellid", "imsi", "imei", "IndicatorID",
            "uemr.rsrpsum", "uemr.rsrpcount",
            "uemr.rsrqsum", "uemr.rsrqcount",
            "uemr.ulsinrsum", "uemr.ulsinrcount",
            "uemr.phrsum", "uemr.phrcount"
    };

    public static final String[] baseFields = {
            "uemr.rsrpsum", "uemr.rsrpcount",
            "uemr.rsrqsum", "uemr.rsrqcount",
            "uemr.ulsinrsum", "uemr.ulsinrcount",
            "uemr.phrsum", "uemr.phrcount"
    };

    @Override
    public String[] getBaseFields() {
        return baseFields;
    }

    public String[] getFields() {
        return fields;
    }

    public Values getValues(Object s) {


//        if (cells.length < 26)
//            return null;
//        if (ts.equals("") || cellid.equals("") || imsi.equals(""))
//            return null;
        UE_MRfield field = (UE_MRfield) s;
        long rsrpsum = getValue(field.getRsrp());
        long rsrpCount = getCount(field.getRsrp());
        long rsrqsum = getValue(field.getRsrq());
        long rsrqCount = getCount(field.getRsrq());
        long ulsinrsum = getValue(field.getUlsinr());
        long ulsinrCount = getCount(field.getUlsinr());
        long phrsum = getValue(field.getPhr());
        long phrCount = getCount(field.getPhr());

        return new Values("uemr", field.getCellid(), field.getImsi(), field.getImei(), field,
                rsrpsum, rsrpCount,
                rsrqsum, rsrqCount,
                ulsinrsum, ulsinrCount,
                phrsum, phrCount
        );
    }

}
